﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PTTK_HTTT_06.BUS;
using System.Data.SqlClient;

namespace PTTK_HTTT_06.DAO
{
    class KHACH_HANG_DB
    {
    
        public static int ThemKH(KHACH_HANG kh)
        {
            DataProvider dataProvider = new DataProvider();

            List<SqlParameter> parameterList = new List<SqlParameter>();
            
            parameterList.Add(new SqlParameter("HoTen", kh.HoTen));
            parameterList.Add(new SqlParameter("SDT", kh.SDT));
            parameterList.Add(new SqlParameter("NgaySinh", kh.NgaySinh.Date));
            parameterList.Add(new SqlParameter("DiemTichLuy", 20));


            int num = -1;
            if (!dataProvider.IsConnect())
                dataProvider.Connect();
            num = dataProvider.ExcuteProcedureWithReturn("ThemKH", parameterList.ToArray());
            dataProvider.Disconnect();

            return num;
        }
    }
}
